Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation of using LLMs #1636

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Conversation

jieguangzhou
Copy link
Collaborator

Description

Related Issues

Checklist

  • Is this code covered by new or existing unit tests or integration tests?
  • Did you run make unit-testing and make integration-testing successfully?
  • Do new classes, functions, methods and parameters all have docstrings?
  • Were existing docstrings updated, if necessary?
  • Was external documentation updated, if necessary?

Additional Notes or Comments

@jieguangzhou jieguangzhou changed the title Remove vllm dependency when using ray to run vllm and doc Remove vllm dependency when using ray to run vllm Jan 3, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (34830a7) 80.33% compared to head (01556cd) 80.35%.
Report is 1362 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1636      +/-   ##
==========================================
+ Coverage   80.33%   80.35%   +0.01%     
==========================================
  Files          95      116      +21     
  Lines        6602     8194    +1592     
==========================================
+ Hits         5304     6584    +1280     
- Misses       1298     1610     +312     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jieguangzhou jieguangzhou marked this pull request as ready for review January 3, 2024 11:17
@jieguangzhou jieguangzhou changed the title Remove vllm dependency when using ray to run vllm Add LLMs document Jan 3, 2024
@jieguangzhou jieguangzhou reopened this Jan 3, 2024
@jieguangzhou jieguangzhou marked this pull request as draft January 3, 2024 11:33
@jieguangzhou jieguangzhou self-assigned this Jan 3, 2024
Comment on lines +156 to +180
def _generate_wrapper(self, prompt: str, **kwargs: Any) -> str:
"""
Wrapper for the _generate method to handle exceptions.
"""
try:
return self._generate(prompt, **kwargs)
except Exception as e:
logging.error(f"Error generating response for prompt '{prompt}': {e}")
return ""

def _batch_generate(self, prompts: List[str], **kwargs: Any) -> List[str]:
"""
Base method to batch generate text from a list of prompts using multi-threading.
Handles exceptions in _generate method.
"""
with concurrent.futures.ThreadPoolExecutor(
max_workers=self.max_batch_size
) as executor:
results = list(
executor.map(
lambda prompt: self._generate_wrapper(prompt, **kwargs), prompts
)
)

return results
Copy link
Collaborator Author

@jieguangzhou jieguangzhou Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use multi-threading instead of async function for concurrent API requests. Because some versions of Jupyter do not directly support asynchronous requests, and this is easier to maintain and understand.

- Support dialog format messages
- Delete the model class in vllm openai format
- Use multi-threading instead of async function for concurrent API requests
@jieguangzhou jieguangzhou changed the title Add LLMs document Improve documentation of using LLMs Jan 4, 2024



## Support Framework/API
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supported?

Copy link
Collaborator

@blythed blythed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small typo. Great work.

@blythed blythed merged commit 31bf879 into superduper-io:main Jan 5, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[LLM] Improve documentation of using LLMs
3 participants